package com.mark.common;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class DataSort {
	
	static public ArrayList<Entry<String,Integer>> mapSort( Map<String, Integer> mapData){
		Map<String, Integer> keyfreqs = mapData;
		ArrayList<Entry<String,Integer>> l = new ArrayList<Entry<String,Integer>>(keyfreqs.entrySet());
		Collections.sort(l, new Comparator<Map.Entry<String, Integer>>() 
				{    
					public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {    
						return (o2.getValue() - o1.getValue());    
					}    
				}); 
		return l;
	}

}
